package com.jsd.jututil;

import java.util.concurrent.CountDownLatch;

/**
 * 计数器 自减
 */
public class CountDownLatchDemo {

    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(6);

        for (int i = 0; i < 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName() + "Go out");
                countDownLatch.countDown();
            }).start();
        }
        countDownLatch.await();
        System.out.println("关门!");
    }
}
